<script>
    const xhr = new XMLHttpRequest()

    xhr.open('POST', 'http://ajax-api.itheima.net/api/data')

    const obj = {
        username: 'admin',
        password: '123456'
    }
    // xhr.send('username=admin&password=123456')
    // xhr.send(obj) // 不能传对象
    xhr.send(JSON.stringify(obj)) // 

    xhr.addEventListener('load', () => {
        console.log(xhr.response)
    })
</script>